import java.io.*;

public class IO
{
   public static void main (String [ ] Jim) throws IOException
   {
      //Declaring variables
      BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));
      int num = 0;
      String decNum;
      String binNum;
      boolean done = false;

      while (!done)
      {
          try
          {
	//Get input from user
	System.out.println( );
	System.out.println("Enter the decimal number for the ascii letter");
	System.out.println( );
	System.out.println("\t65)  A");
	System.out.println("\t66)  B");
	System.out.println("\t67)  C");
	decNum = dataIn.readLine( );
	num = Integer.parseInt(decNum);

	if (num < 65 || num > 67)
	{
	    System.out.println("\tThe number must be between 65 and 67.");
	    throw new NumberFormatException ( );
	}// end if

	done = true;  //end first loop
          }// end try
 
          catch (NumberFormatException e)
          {
	System.out.println("\tYour response was not a valid number.");
	System.out.println("\tPlease reenter using the allowable numeric values.");
	System.out.println( );
          } // end catch

      } // end while

    done = false;   //enter second loop
   
     binNum = getBinary(num); 
     
     //Display Output
    System.out.println( );
    System.out.println("\tThe binary equivalent is " + binNum); 

   } //end main


//METHODS

public static String getBinary( int findBin)
{
   String theBinary;

   switch(findBin)
   {
      
      case 65: theBinary = "01000001";
                   break;
      case 66: theBinary = "01000010";
                   break;
      case 67: theBinary = "01000011";
                   break;
      default:  throw new NumberFormatException( );
   } // end switch

   return theBinary;

}// end getBinary

} //end class